# -*- coding: utf-8 -*-

import struct


def cxx_dump_bool(value: bool):
    value_int = 1 if value else 0
    return struct.pack('B', value_int)


def cxx_dump_int32(value: int):
    return struct.pack('i', value)


def cxx_dump_float(value: float):
    return struct.pack('f', value)


def cxx_dump_complex(value: complex):
    # , float(value.imag)
    return cxx_dump_float(float(value.real)) + cxx_dump_float(float(value.imag))